package com.scenic.rd_android.testsensor;

import android.content.Context;
import android.content.Intent;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;

import com.nova.scenic.projectlibs.util.debug.MyLog;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.List;


/**
 * Created by scenic on 16/6/24.
 */
@RunWith(AndroidJUnit4.class)
@LargeTest
public class TestSensorActivityTest {

    MyLog mylog = new MyLog("TestSensorActivityTest");
    @Rule
    public ActivityTestRule<TestSensorActivity> activityActivityTestRule = new ActivityTestRule<TestSensorActivity>(TestSensorActivity.class,true,false);

    @Test
    public void testGetSensorList(){
        activityActivityTestRule.launchActivity(new Intent());
        SensorManager manager = (SensorManager) activityActivityTestRule.getActivity().getSystemService(Context.SENSOR_SERVICE);
        List<Sensor> list = manager.getSensorList(Sensor.TYPE_ORIENTATION);
        for (Sensor sensor : list) {
            mylog.info("sensor is " + sensor);
        }

    }

}
